﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DocManagerORM.ORM
{
   public class QueryIters :QueryBase
    {
       public int updateItersManager(ref ItersManager pItersManager)
       {
           m_Entity.AddToItersManager(pItersManager);
           return m_Entity.SaveChanges(System.Data.Objects.SaveOptions.AcceptAllChangesAfterSave );
 
       }//fM


       public int updateIters(ref Iters pIters)
       {
           m_Entity.AddToIters(pIters);
           return m_Entity.SaveChanges(System.Data.Objects.SaveOptions.AcceptAllChangesAfterSave);

       }//fM


       public IQueryable<ItersManager> getItersManager(int? pId,bool pIncludeIters)
       { 
           IQueryable<ItersManager> query = null;
           if (pIncludeIters)
            query = m_Entity.ItersManager.Include("Iters");
           else
            query = m_Entity.ItersManager;

           if (pId.HasValue)
               query = query.Where(x => x.ID == pId);
            

           return query;

       }//fM

    }//fC
}
